
#ifndef LOD_PLANE_H
#define LOD_PLANE_H

#include <cmath>

class plane
{
    public:
    float A,B,C,D;
    // the equation of a plane
    // Ax + By + Cz + D = 0
    // where (A,B,C) is a normal vector
    // and D specifies the plane ( if P=(Px,Py,Pz), then D = -(APx + BPy + CPz) )

    plane(float a,float b,float c,float d) : A(a), B(b), C(c), D(d) {}
    
    //! normalize plane's parameters so the normal vector has a length 1
    void normalize()
    {
        float n = std::sqrt(A*A + B*B + C*C);
        if(n!=0.0f) {
            A /= n;
            B /= n;
            C /= n;
            D /= n;
        }
    }
};

#endif // LOD_PLANE_H
